import Vue from 'vue'
import * as filter from './filter'

if (!Number.prototype._toFixed) {
  Number.prototype._toFixed = Number.prototype.toFixed
}
Number.prototype.toFixed = function(n) {
  return this > 0 ? (this + 1e-12)._toFixed(n) : (this - 1e-12)._toFixed(n)
}

Object.keys(filter).forEach(k => Vue.filter(k, filter[k]))

Vue.prototype.$formatDate = Vue.filter('formatDate')
Vue.prototype.$hidePhone = Vue.filter('hidePhone')
Vue.prototype.$percent = Vue.filter('percent')
Vue.prototype.$ptFormat = Vue.filter('ptFormat')
Vue.prototype.$unitConvert = Vue.filter('unitConvert')
Vue.prototype.$detailUnitNumber = Vue.filter('detailUnitNumber')
